package com.eke.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.eke.bean.ClassHour;
import com.eke.bean.CourseChapters;
import com.eke.dao.ClassHourDao;
import com.eke.dao.CourseChaptersDao;
import com.eke.service.CourseChapterSevice;

@Service
public class CourseChapterSeviceImpl implements CourseChapterSevice {
	@Resource
	private ClassHourDao cDao;
	@Resource
	private CourseChaptersDao courseChaptersDao;

	/**
	 * 添加课程返回章节ID
	 * 
	 * @param courseChapters
	 *            课程章节
	 * @return courseChaptersId 返回课程章节id
	 */
	public int addCourseChapter(CourseChapters courseChapters) {
		// TODO Auto-generated method stub
		return courseChaptersDao.addCourseChapter(courseChapters);
	}

	/**
	 * 添加课时
	 * 
	 * @param classHour
	 *            课时
	 * @return boolean
	 */
	public boolean addClassHour(ClassHour classHour) {
		return cDao.addClassHour(classHour);
	}

	/**
	 * 查询章节
	 * 
	 * @param courseId
	 *            课程id
	 * @return List<CourseChapters>
	 */
	public List<CourseChapters> queryCourseChapter(Integer courseId) {
		return courseChaptersDao.queryCourseChapter(courseId);
	}

	/**
	 * 查询课时
	 * 
	 * @param courseChapterId
	 *            章节ID
	 * @return ClassHour
	 */
	public ClassHour queryClassHours(Integer courseChapterId) {
		return cDao.queryClassHours(courseChapterId).get(0);
	}

	/**
	 * 根据课时id查询课时详情
	 * 
	 * @param classHourId
	 *            课时ID
	 * @return {@link List}<{@link ClassHour}>
	 */
	
	public List<ClassHour> queryClassHourByHourId(Integer classHourId) {
		// TODO Auto-generated method stub
		return cDao.queryClassHourByHourId(classHourId);
	}

}
